package com.tn.tgt.easybuy.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tn.tgt.easybuy.mapper.EbNewsMapper;
import com.tn.tgt.easybuy.model.EbNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EbNewsServicelmpl implements  EbNewsService{

    @Autowired
    private EbNewsMapper ebNewsMapper;

    @Override
    public List<EbNews> selectList(Integer pSize, Integer pageSize) {
        Page<EbNews> page=new Page(pSize,pageSize);
        Page<EbNews> ebNewsPage = ebNewsMapper.selectPage(page,
                Wrappers.<EbNews> lambdaQuery().orderByDesc(EbNews::getEnCreateTime));
        return ebNewsPage.getRecords();
    }

    @Override
    public EbNews detail(Integer enId) {
        return ebNewsMapper.selectById(enId);
    }
}
